#include "stdafx.h"
#include "Fakes/FakeD3D10Device.h"
#include "Fakes/FakeD3D10RasterizerState.h"

DESCRIPTION_10_TEST_SUITE(RasterizerDescription)

BOOST_FIXTURE_TEST_CASE(Default, TestRasterizerDescription)
{
	BOOST_REQUIRE_EQUAL(D3D10_FILL_SOLID, m_desc.FillMode);
	BOOST_REQUIRE_EQUAL(D3D10_CULL_BACK, m_desc.CullMode);
	BOOST_REQUIRE_EQUAL(FALSE, m_desc.FrontCounterClockwise);
	BOOST_REQUIRE_EQUAL(D3D10_DEFAULT_DEPTH_BIAS, m_desc.DepthBias);
	BOOST_REQUIRE_EQUAL(D3D10_DEFAULT_DEPTH_BIAS_CLAMP, m_desc.DepthBiasClamp);
	BOOST_REQUIRE_EQUAL(D3D10_DEFAULT_SLOPE_SCALED_DEPTH_BIAS, m_desc.SlopeScaledDepthBias);
	BOOST_REQUIRE_EQUAL(TRUE, m_desc.DepthClipEnable);
	BOOST_REQUIRE_EQUAL(FALSE, m_desc.ScissorEnable);
	BOOST_REQUIRE_EQUAL(FALSE, m_desc.MultisampleEnable);
	BOOST_REQUIRE_EQUAL(FALSE, m_desc.AntialiasedLineEnable);
}

#define RASTERIZER_DESCRIPTION_TEST_CASE(type_, name_, value_) \
	DESCRIPTION_10_TEST_CASE(type_, name_, value_, RasterizerDescription)

RASTERIZER_DESCRIPTION_TEST_CASE(D3D10_FILL_MODE, FillMode, D3D10_FILL_WIREFRAME)
RASTERIZER_DESCRIPTION_TEST_CASE(D3D10_CULL_MODE, CullMode, D3D10_CULL_FRONT)
RASTERIZER_DESCRIPTION_TEST_CASE(BOOL, FrontCounterClockwise, TRUE)
RASTERIZER_DESCRIPTION_TEST_CASE(int, DepthBias, 1964)
RASTERIZER_DESCRIPTION_TEST_CASE(float, DepthBiasClamp, 1964.0f)
RASTERIZER_DESCRIPTION_TEST_CASE(float, SlopeScaledDepthBias, 1964.0f)
RASTERIZER_DESCRIPTION_TEST_CASE(BOOL, DepthClipEnable, FALSE)
RASTERIZER_DESCRIPTION_TEST_CASE(BOOL, ScissorEnable, TRUE)
RASTERIZER_DESCRIPTION_TEST_CASE(BOOL, MultisampleEnable, TRUE)
RASTERIZER_DESCRIPTION_TEST_CASE(BOOL, AntialiasedLineEnable, TRUE)

BOOST_FIXTURE_TEST_CASE(Create, TestRasterizerDescription)
{
	FakeD3D10Device device;
	FakeD3D10RasterizerState state;
	device.CreateRasterizerStateFakeResult = &state;
	device.CreateRasterizerStateFakeHResult = S_OK;
	ID3D10RasterizerState *result = m_desc.Create(&device);
	BOOST_REQUIRE(device.CreateRasterizerStateCalled);
	BOOST_REQUIRE_EQUAL(&m_desc, device.CreateRasterizerStateLastDesc);
	BOOST_REQUIRE_EQUAL(&state, result);
}

BOOST_AUTO_TEST_SUITE_END()
